package com.aaa.sbms.controller;

import com.aaa.sbms.service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @FileName:TrainController
 * @Description:
 * @Author :99728
 * @Date: 2020/6/17 16:14
 * @Version:1.0.0
 */
@RestController
@RequestMapping("train")
public class TrainController {

    @Autowired(required = false)
    private TrainService trainService;

    /**
     * 分页计划与实施
     * @param map
     * @return
     */
    @RequestMapping("page")
    public Object page(@RequestParam Map map){
        return trainService.getPage(map);
    }


    @RequestMapping("getCourseName")
    public Map getCourseName(@RequestParam Map map) {
        return trainService.getCourseName(map);
    }
    @RequestMapping("getTrainerName")
    public List<Map> getTrainername(@RequestParam Map map) {
        return trainService.getTrainerName(map);
    }
    @RequestMapping("getUserName")
    public Map getUserName(@RequestParam Map map) {
        return trainService.getUserName(map);
    }

    /**
     * 添加
     * @param map
     * @return
     */
    @RequestMapping("add")
    public Object add(@RequestBody Map map){
        return trainService.add(map);
    }

    /**
     * 删除
     * @param trainid
     * @return
     */
    @RequestMapping("delete")
    public Object delete(int trainid){
        return trainService.delete(trainid);
    }

}
